<?php
$this->Html->addCrumb('Budgets', '/admin/budgets/main');
$this->Html->addCrumb('Budget Templates','/admin/budgets');
$this->Html->addCrumb('Edit');
?>
<?php
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#BudgetAdminEditForm").TWS_Form( {
          validate : {
          rules : {
            BudgetDescription : {required : true, help : "A name/description for the budget template"},
          }
          }});
     
         $("#deleteBtn").click(function(event){
          if(!$("#deleteBtn").attr("data-delete-confirm")) {
          $("#deleteBtn").attr("data-delete-confirm","");
            $.TWS_Overlay("confirm", {title : "Delete confirmation", message : "Are you sure you want to delete this budget template? <br/><br/>Please note all groups and items/tasks linked to this template will also be deleted!", buttons : {ok :{onclick : function () { $.TWS_Overlay("hide"); $("#deleteBtn").attr("data-delete-confirm",true).trigger("click");}}}});
            event.preventDefault();
          }
        });
      });
       ';
$this->Html->scriptEnd();

?>


<h1>Edit Budget Template</h1>
<?php echo $this->Session->flash();?>
<?php echo '<div id="actionLink">'.$this->Html->link('Back to list of Templates',array('action'=>'index', 'admin'=>true)).'</div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('Budget',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));
echo $this->TWSForm->input('description', array('type'=>'text', 'size'=>50,  'name'=>'BudgetDescription', 'label'=>'<span class="required">*</span>Name'));

echo $this->TWSForm->submit('Update', array('id'=>'editBtn', 'name'=>'editBtn', 'class'=>'button', 'div'=>false));
echo $this->TWSForm->submit("Delete", array('id'=>'deleteBtn','name'=>'deleteBtn', 'class'=>'button', 'div'=>false));
echo $this->TWSForm->end();

?>